/**
 *
 *  @auth xlx_good@qq.com
 *  @date 17/4/27.
 *
 */

import Vue from 'vue';
import Router from 'vue-router';

Vue.use(Router);

import login from '../views/login/login.vue';
import register from '../views/register/register.vue';
import complete from '../views/complete/complete.vue';
import check from '../views/prompt/check.vue';
import pwdSuc from '../views/prompt/pwdSuc.vue';
import checkFail from '../views/prompt/check-fail.vue';
import forgetPwd from '../views/forgetPwd/forgetPwd.vue';
import rePwd from '../views/rePwd/rePwd.vue';
import home from '../views/home/home.vue';
import search from '../views/search/search.vue';
import site from '../views/site/site.vue';
import me from '../views/me/me.vue';
import order from '../views/me/order.vue';
import pandaBiList from '../views/me/pandaBiList.vue';
import salesman from '../views/me/salesman.vue';
import shouhou from '../views/me/shouhou.vue';
import account from '../views/me/account.vue';
import general from '../views/me/general.vue';
import seting from '../views/me/seting.vue';
import about from '../views/me/about.vue';
import boss from '../views/me/boss.vue';
import user from '../views/me/user.vue';
import examine from '../views/me/examine.vue';
import orderList from '../views/order/list.vue';
import orderOrder from '../views/order/order.vue';
import orderDetail from '../views/order/detail.vue';
import orderPay from '../views/order/pay.vue';
import orderInvoice from '../views/order/invoice.vue';
import purchase from '../views/purchase/purchase.vue';
import purchaseList from '../views/purchase/list.vue';
import purchaseDetail from '../views/purchase/detail.vue';
import purchaseApply from '../views/purchase/apply.vue';
import purchaseCheck from '../views/purchase/check.vue';
import purchaseMy from '../views/purchase/my.vue';
import category from '../views/goods/category.vue';
import goodsList from '../views/goods/list.vue';
import goodsDetail from '../views/goods/detail.vue';
import favorites from '../views/favorites/favorites.vue';
import change from '../views/change/change.vue';
import changeList from '../views/change/list.vue';
import storeSub from '../views/me/store-sub.vue';
import addressList from '../views/address/list.vue';
import addressAdd from '../views/address/add.vue';
import addressEdit from '../views/address/edit.vue';
import hot from '../views/home/hot.vue';
import newGoods from '../views/home/newGoods.vue';
import museum from '../views/home/museum.vue';
import newbie from '../views/home/newbie.vue';
import store from '../views/store/store.vue';
import build from '../views/home/build.vue';
import applyPurchaseDetail from '../views/purchase/apply-detail.vue';



export default new Router({
  mode: 'hash',
  base: '/',
  scrollBehavior: (to, from, savedPosition) => {
    console.log('savedPosition', savedPosition);
    if (savedPosition) {
      console.log('savedPosition', savedPosition);
      return savedPosition
    } else {
      return { x: 0, y: 0 }
    }
  },
  routes: [
    {path: '/', component: home, name: '/'},
    {path: '/login', component: login, name: 'login',meta: {title: '登录'}},
    {path: '/register', component: register, name: 'register',meta: {title: '注册'}},
    {path: '/complete', component: complete, name: 'complete',meta: {title: '完善资料'}},
    {path: '/check', component: check, name: 'check'},
    {path: '/checkFail', component: checkFail, name: 'checkFail'},
    {path: '/pwdSuc', component: pwdSuc, name: 'pwdSuc'},
    {path: '/forgetPwd', component: forgetPwd, name: 'forgetPwd',meta: {title: '忘记密码'}},
    {path: '/rePwd', component: rePwd, name: 'rePwd',meta: {title: '重置密码'}},
    {path: '/home', component: home, name: 'home',meta: {title: '首页'}},
    {path: '/search', component: search, name: 'search',meta: {title: '搜索'}},
    {path: '/site', component: site, name: 'site'},
    {path: '/me', component: me, name: 'me',meta: {title: '我的'}},
    {path: '/me/user', component: user, name: 'user'},
    {path: '/me/pandaBiList', component: pandaBiList, name: 'pandaBiList',meta: {title: '熊猫币'}},
    {path: '/me/examine', component: examine, name: 'examine'},
    {path: '/order', component: order, name: 'order'},
    {path: '/order/pay/:orderCode/money/:money', component: orderPay, name: 'orderPay'},
    {path: '/salesman', component: salesman, name: 'salesman',meta: {title: '我的业务员'}},
    {path: '/shouhou', component: shouhou, name: 'shouhou',meta: {title: '申请售后'}},
    {path: '/account', component: account, name: 'account'},
    {path: '/general', component: general, name: 'general'},
    {path: '/seting', component: seting, name: 'seting',meta: {title: '设置'}},
    {path: '/about', component: about, name: 'about',meta: {title: '熊猫联采'}},
    {path: '/order/list/:type', component: orderList, name: 'orderList',meta: {title: '我的订单'}},
    {path: '/order/order/:orderCode/:orderSource', component: orderOrder, name: 'orderOrder'},
    {path: '/order/detail/:orderCode', component: orderDetail, name: 'orderDetail',meta: {title: '订单详情'}},
    {path: '/order/invoice/:orderCode', component: orderInvoice, name: 'orderInvoice'},
    {path: '/purchase/goodsId/:goodId', component: purchase, name: 'purchase'},
    {path: '/purchase/list', component: purchaseList, name: 'purchaseList',meta: {title: '采购单'}},
    {path: '/purchase/detail/:addressId', component: purchaseDetail, name: 'purchaseDetail'},
    {path: '/purchase/detail/:addressId/:type', component: purchaseDetail, name: 'checkPurchaseDetail'},
    {path: '/purchase/apply', component: purchaseApply, name: 'purchaseApply'},
    {path: '/purchase/apply/detail/:status/:uniqueCode', component: applyPurchaseDetail, name: 'applyPurchaseDetail'},
    {path: '/purchase/apply/detail/order/:orderId/:status/:uniqueCode', component: applyPurchaseDetail, name: 'applyPurchaseDetailByOrder'},
    {path: '/purchase/check/:addressId/:userIdSub', component: purchaseCheck, name: 'purchaseCheck'},
    {path: '/purchase/my', component: purchaseMy, name: 'purchaseMy'},
    {path: '/category', component: category, name: 'category'},
    // {path: '/goods/list/:cateId/:brandId', component: goodsList, name: 'goodsList'},
    {path: '/goods/list/cate/:cateId/:brandId', component: goodsList, name: 'goodsListCate'},
    {path: '/goods/list/hot/:tagId/:labelName/:cateId', component: goodsList, name: 'goodsListHot'},
    {path: '/goods/list/new/:tagId/:labelName', component: goodsList, name: 'goodsListNew'},
    {path: '/goods/list/newbie/:tagId/:labelName/:cateId', component: goodsList, name: 'goodsListNewbie'},
    // {path: '/goods/list/:wareName', component: goodsList, name: 'goodsList'},
    {path: '/goods/list/wareName/:wareName', component: goodsList, name: 'goodsListWareName'},
    {path: '/goods/list', component: goodsList, name: 'goodsList'},
    {path: '/goods/detail/:wareId', component: goodsDetail, name: 'goodsDetail'},
    {path: '/favorites', component: favorites, name: 'favorites',meta: {title: '我的收藏'}},
    {path: '/change/list', component: changeList, name: 'changeList'},
    {path: '/change/apply', component: change, name: 'change'},
    {path: '/store/sub', component: storeSub, name: 'storeSub'},
    {path: '/boss', component: boss, name: 'boss'},
    {path: '/address/list', component: addressList, name: 'addressList',meta: {title: '地址管理'}},
    {path: '/address/add', component: addressAdd, name: 'addressAdd'},
    {path: '/address/edit/:addressId', component: addressEdit, name: 'addressEdit',meta: {title: '编辑地址'}},
    {path: '/hot', component: hot, name: 'hot'},
    {path: '/newGoods', component: newGoods, name: 'newGoods'},
    {path: '/museum', component: museum, name: 'museum'},
    {path: '/newbie', component: newbie, name: 'newbie'},
    {path: '/store/:storeId', component: store, name: 'store'},
    {path: '/build', component: build, name: 'build'},
  ]
})
